/**
 * 
 */
package com.wubo.sec.core;

import java.util.Map;

import org.springframework.beans.factory.InitializingBean;

/**
 * @author WuBo
 * @CreateDate 2010-9-2
 * @version 1.0.01
 */
public class LoginProcessRegistry implements InitializingBean{

	private Map<String, UserLoginProcessor> userLoginProcessors;
	
	public Map<String, UserLoginProcessor> getUserLoginProcessors() {
		return userLoginProcessors;
	}

	public void setUserLoginProcessors(Map<String, UserLoginProcessor> userLoginProcessors) {
		this.userLoginProcessors = userLoginProcessors;
	}

	public void afterPropertiesSet() throws Exception {
		if(userLoginProcessors == null || userLoginProcessors.isEmpty()){
			throw new SecurityException("There are no UserLoginProcessors has been found. At least one UserLoginProcessor is required.");
		}
		UserLoginPageHelper.setLoginProcessor(userLoginProcessors);
	}
	
}
